package models;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.validation.Valid;

import play.data.validation.Constraints.Email;
import play.data.validation.Constraints.Required;
import play.db.ebean.Model;

@Entity
public class Information  extends Model{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -1507613286624215151L;


	@Id
	public Long id;
	
    
    @Required
    public String label;
    
    @Email
    public String email;
    
    @Required
    public String adress;
    
    @Valid
    public List<Phone> phones;
    
    public Information() {}
    
    public Information(String label, String email,String adress,String... phones) {
        this.label = label;
        this.email = email;
        this.adress= adress;
        this.phones = new ArrayList<Phone>();
        for(String phone: phones) {
            this.phones.add(new Phone(phone));
        }
    }
    
   
}
